home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #11 / Amiga Plus CD - 2004 - No. 11.iso / AmiSoft / Mus / misc / p6106.lha / Player6.1A / Source / CIA_Example.G < prev    next >
Text File  |  1994-12-23  |  2KB  |  94 lines

  1. * An example of how to use Copper-Interrupt bit to wait for specified line
  2. * Also AGA-compatible init
  3.  
  4.  
  5. * For use with CIA-version of the Player 6.1A
  6.  
  7.     section    "CIA-Example",code
  8.  
  9.     movem.l    d0-a6,-(sp)
  10.     move    $dff002,-(sp)        ;Old DMA
  11.     lea    gfxname(pc),a1        ;Open graphics.library
  12.     moveq    #0,d0
  13.     move.l    4.w,a6
  14.     jsr    -$228(a6)
  15.     move.l    d0,a6
  16.     move.l    34(a6),-(sp)        ;Old view
  17.     move.l    a6,-(sp)
  18.     sub.l    a1,a1
  19.     jsr    -$de(a6)        ;LoadView
  20.     jsr    -$10e(a6)        ;WaitTOF
  21.     jsr    -$10e(a6)        ;WaitTOF
  22.  
  23.     lea    $dff000,a6
  24.     move    #$7ff,$96(a6)        ;Disable DMAs
  25.     move    #%1000001111000000,$96(a6) ;Master,Copper,Blitter,Bitplanes
  26.     move    $1c(a6),-(sp)        ;Old IRQ
  27.     move    #$7fff,$9a(a6)        ;Disable IRQs
  28.     move    #$e000,$9a(a6)        ;Master and lev6
  29.                     ;NO COPPER-IRQ!
  30.     moveq    #0,d0
  31.     move    d0,$106(a6)        ;Disable AGA/ECS-stuff
  32.     move    d0,$1fc(a6)
  33.  
  34. ;    Call P61_Init here!
  35.  
  36.     move.l    #copper,$80(a6)
  37.  
  38. wait    move    $1e(a6),d0        ;Wait for Copper-bit in INTREQR
  39.     and.l    #$10,d0
  40.     beq.b    wait
  41.  
  42.     move    #$10,$9c(a6)        ;Clear the bit
  43.  
  44.     move    #$f00,$180(a6)        ;Some funny colors...
  45.  
  46. ; Do your stuff here!
  47.  
  48.     move    #3,$180(a6)
  49.  
  50.     btst    #6,$bfe001
  51.     bne    wait
  52.     
  53. exit    btst    #14,2(a6)        ;Wait for blitter to finish
  54.     bne.b    exit
  55.  
  56. ; Call P61_End here!
  57.  
  58.     move    #$7fff,$9a(a6)        ;Restore system status
  59.     move    #$7ff,$96(a6)
  60.  
  61.     move    (sp)+,d7        ;Old IRQs
  62.  
  63.     move.l    (sp)+,a6
  64.     move.l    (sp)+,a1
  65.     jsr    -$de(a6)        ;Old view
  66.     move.l    38(a6),d3        ;Old Copper1
  67.     move.l    a6,a1
  68.     move.l    4.w,a6
  69.     jsr    -$19e(a6)        ;CLOSE graphics.library
  70.  
  71.     lea    $dff000,a6
  72.     move.l    d3,$80(a6)        ;Set old Copper
  73.     move    d3,$88(a6)        ;Trigger
  74.  
  75.     or    #$8000,d7
  76.     move    d7,$9a(a6)        ;Old IRQs
  77.  
  78.     move    (sp)+,d7
  79.     or    #$8000,d7
  80.     move    d7,$96(a6)        ;Old DMAs
  81.     movem.l    (sp)+,d0-a6
  82.     moveq    #0,d0            ;No error code
  83.     rts
  84.  
  85. gfxname    dc.b    `graphics.library`,0
  86.     even
  87.  
  88.     section    "Copper",data_c
  89. copper    dc    $100,$0200
  90.     dc    $180,3
  91.     dc    $800f,-2        ;The line to wait to
  92.     dc    $9c,$8010        ;Set Copper-bit in INTREQ
  93.     dc.l    -2
  94.